<?php
use Entities;
use Entities\Funcionario;

$xml = "";

$id = (isset($_REQUEST["id"]))? get_request("id") :"" ;
$nome = (isset($_REQUEST["nome"]))? get_request("nome") :"" ;

$telefone = (isset($_REQUEST["telefone"]))? get_request("telefone") :"" ;
$nextel = (isset($_REQUEST["nextel"]))? get_request("nextel") :"" ;
$email = (isset($_REQUEST["email"]))? get_request("email") :"" ;



$c = $em->find("Entities\Funcionario", $id); 	
if(empty($c)){
	$c = new Funcionario();
}


$c->setNome($nome);
$c->setTelefone($telefone);
$c->setNextel($nextel);
$c->setEmail($email);

$em->persist($c);
try {
	$em->flush();
	$erro = 0;
} catch (Exception $e) {
	$erro = $e->getMessage();
	//$erro = 1;
}

$xml .= "<erro>$erro</erro>";
echo $xml;